package com.wps.shell.controls.scroll
{
	import flash.display.Sprite;
	
	import mx.core.UIComponent;
	
	import spark.components.Group;
	[Event(name="scroll_move", type="com.wps.shell.controls.scroll.ScrollWindowEvent")]
	public class ScrollWindow extends Group
	{
		private var _thumb: ScrollWindowThumb;
		private var _scale: Number = 1;
		private var _site: Number = 0;
		public function ScrollWindow()
		{
			
		}
		
		public function initData(scale: Number, site: Number): void
		{
			_scale = scale;
			_site  = site;
			_thumb.width = width / _scale;
		}
		
		override protected function createChildren():void
		{
			super.createChildren();
			if(!_thumb)
			{
				_thumb = new ScrollWindowThumb();
				_thumb.percentHeight = 100;
				_thumb.addEventListener(ScrollWindowEvent.Move, _scrollEventHandler);
				addElement(_thumb);
			}	
		}
		
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
		}	
		
		private function _scrollEventHandler(event: ScrollWindowEvent): void
		{
			var e: ScrollWindowEvent = event.cloneEvent();
			dispatchEvent(e);
		}
			
	}
}